package com.digitalchina.lxnsy.api;

import android.app.Activity;
import android.os.Handler;

import com.digitalchina.lxnsy.constant.MSG;
import com.digitalchina.lxnsy.constant.URL;
import com.digitalchina.lxnsy.toolkit.OkHttpUtil;
import com.lzy.okhttputils.model.HttpParams;

/**
 * ================================================
 * 项目名称：BigData
 * 类描述：
 * 包名：com.digitalchina.bigdata.api
 * 创建人：jiabo
 * 创建时间：2017/3/24 11:50
 * 修改备注：
 * ================================================
 */

public class BusinessTrainingVideo {

    /**
     * 发起培训
     *
     * @param activity
     * @param page     页码
     * @param num      数量
     * @param code     分类code
     * @param keyWords 查询关键词，默认空为所有
     * @param handler
     */
    public static void getTrainingVideoList(Activity activity, String page, String num, String code, String keyWords, String queryDataType, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("page", page);
        params.put("perPage", num);
        params.put("name", keyWords);
        params.put("videoTypeCode", code);
        params.put("queryDataType", queryDataType);
        OkHttpUtil.get(activity, URL.URL_GET_TRAINING_VIDEO_LIST, "", params, handler, MSG.MSG_TRAINING_SAVE_SUCCESS, MSG.MSG_TRAINING_SAVE_FIELD);
    }


    /**
     * 农科大讲堂分类
     *
     * @param activity
     * @param handler
     */
    public static void getVideoOpts(Activity activity, Handler handler) {
        HttpParams params = new HttpParams();
        params.put("pCode","BIZ_EXPERT_TYPE");
        OkHttpUtil.get(activity, URL.URL_SHARE_FARM_TYPE, "", params, handler, MSG.MSG_SHARE_FARM_TYPE_SUCCESS, MSG.MSG_SHARE_FARM_TYPE_FIELD);
    }


    /**
     * 直播视频报名
     *
     * @param activity
     * @param agriClassesId
     * @param name
     * @param mobilePhone
     * @param addressDetail
     * @param provinceCode
     * @param cityCode
     * @param countyCode
     * @param handler
     */
    public static void saveSignUpInfo(Activity activity, String agriClassesId, String name, String mobilePhone, String addressDetail, String provinceCode, String cityCode, String countyCode, Handler handler) {

        HttpParams params = new HttpParams();
        params.put("agriClassesId", agriClassesId);
        params.put("name", name);
        params.put("mobilePhone", mobilePhone);
        params.put("addressDetail", addressDetail);
        params.put("provinceCode", provinceCode);
        params.put("cityCode", cityCode);
        params.put("countyCode", countyCode);

        OkHttpUtil.post(activity, URL.URL_SAVE_SIGN_UP_INFO, "", params, handler, MSG.MSG_SAVE_SIGN_UP_INFO_SUCCESS, MSG.MSG_SAVE_SIGN_UP_INFO_FIELD);
    }

}
